home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / MM3MCp.sea Folder / Made by Marksman / Sources / u / My_basic_window.cp < prev    next >
Encoding:
Text File  |  1994-01-16  |  5.0 KB  |  203 lines  |  [TEXT/MMCC]

  1.  
  2. /*  My_basic_window                                 Handle this Window */
  3. /*  Copyright © 1994 George R. Cossey */
  4.  
  5. /* 
  6.     File name: My_basic_window
  7.     Function: Handle a Window 
  8.     History: 1/16/94 Original by George Cossey
  9.  
  10. */
  11.  
  12. #include "mmCommonMM_Demo.h"    /* Common */
  13. #include "CommonMM_Demo.h"        /* Common */
  14.  
  15. /* ======================================================= */
  16. /* ======================================================= */
  17.  
  18. void CWMy_basic_window::Init()
  19. {
  20. inherited::Init();
  21. }
  22.  
  23.  
  24. /* ======================================================= */
  25.  
  26. void CWMy_basic_window::CloseExtras(Ptr theWS)
  27. {
  28. My_basic_windowPRec        myWS;
  29.  
  30. inherited::CloseExtras(theWS);
  31. myWS = (My_basic_windowPRec)theWS;
  32. }
  33.  
  34. /* ======================================================= */
  35.  
  36. void CWMy_basic_window::UpdateExtras(Ptr theWS)
  37. {
  38. My_basic_windowPRec        myWS;
  39.  
  40. inherited::UpdateExtras(theWS);
  41. myWS = (My_basic_windowPRec)theWS;
  42. }
  43.  
  44. /* ======================================================= */
  45.  
  46. void CWMy_basic_window::OpenExtras(Ptr theWS)
  47. {
  48. My_basic_windowPRec        myWS;
  49.  
  50. inherited::OpenExtras(theWS);
  51. myWS = (My_basic_windowPRec)theWS;
  52. }
  53.  
  54. /* ======================================================= */
  55.  
  56. void CWMy_basic_window::ActivateExtras(Boolean Do_An_Activate,Ptr theWS)
  57. {
  58. My_basic_windowPRec        myWS;
  59.  
  60. inherited::ActivateExtras(Do_An_Activate,theWS);
  61. myWS = (My_basic_windowPRec)theWS;
  62.  
  63. if (!Do_An_Activate)                            /* Handle the deactivate */
  64.     {
  65.     }
  66. else
  67.     {
  68.     }
  69. }
  70.  
  71. /* ======================================================= */
  72.  
  73. void CWMy_basic_window::HandleExtraButtons(Ptr theWS,ControlHandle theControl,short *UnHiliteValue)
  74. {
  75. My_basic_windowPRec        myWS;
  76. short                theSelection;
  77. long                RefCon;
  78.  
  79.  
  80. inherited::HandleExtraButtons(theWS,theControl,UnHiliteValue);
  81. myWS = (My_basic_windowPRec)theWS;
  82.  
  83. RefCon = GetCRefCon(theControl);                    /* get control refcon */
  84.  
  85. switch (RefCon)                                        /* Select correct button */
  86.     {
  87.     case ResC_Button:                    /* Button, Button */
  88.         break;
  89.     case ResC_Rect_hotspot2:                    /* HotSpot, Rect hotspot2 */
  90.         break;
  91.     case ResC_Icon:                    /* Icon, Icon */
  92.         break;
  93.     case ResC_Sicn:                    /* Sicn, Sicn */
  94.         break;
  95.     case ResC_Picture:                    /* Picture, Picture */
  96.         break;
  97.     case ResC_Tool_palette:                /* Tool palette, Tool palette */
  98.         break;
  99.  
  100.     default:                                    /* allow other buttons, trap for debug */
  101.         break;                                /* end of otherwise */
  102.     }                                            /* end of switch */
  103. }
  104.  
  105. /* ======================================================= */
  106.  
  107. void CWMy_basic_window::HandleExtraCheckboxes(Ptr theWS,ControlHandle theControl)
  108. {
  109. My_basic_windowPRec        myWS;
  110. long    RefCon;                                        /* RefCon for controls */
  111.  
  112.  
  113. inherited::HandleExtraCheckboxes(theWS,theControl);
  114. myWS = (My_basic_windowPRec)theWS;
  115.  
  116. RefCon = GetCRefCon(theControl);                    /* get control refcon */
  117.  
  118. switch (RefCon)                                        /* Select correct control */
  119.     {
  120.     case ResC_Checkbox:                        /* Checkbox, Checkbox  */
  121.         if (myWS->Value_Checkbox == 0)
  122.             {
  123.             }
  124.         else
  125.             {
  126.             }
  127.         break;
  128.         
  129.  
  130.     default:                                    /* allow other checkboxes and radios, trap for debug */
  131.         break;                                    /* end of otherwise */
  132.     }                                            /* end of case */
  133. }
  134.  
  135. /* ======================================================= */
  136.  
  137. /* Routine: HandleScrollBar */
  138. /* Purpose: Handle a ScrollBar being pressed */
  139.  
  140. void CWMy_basic_window::HandleScrollBar(short code,ControlHandle theControl,Point myPt)
  141. {
  142. long    RefCon;                                    /* RefCon for controls */
  143.  
  144.  
  145. inherited::HandleScrollBar(code,theControl,myPt);
  146. RefCon = GetCRefCon(theControl);                /* get control refcon */
  147.  
  148. switch (RefCon)                                    /* Select correct scrollbar */
  149.     {
  150.     case ResC_Scroll_bar:                    /* Scroll bar, Scroll bar  */
  151.         break;
  152.  
  153.     default:                                    /* allow other buttons, trap for debug */
  154.         break;                                    /* end of otherwise */
  155.     }                                            /* end of switch */
  156. }
  157.  
  158. /* ======================================================= */
  159.  
  160. /* Routine: HandleEvent */
  161. /* Purpose: Handle action to our window, like controls */
  162.  
  163. void CWMy_basic_window::HandleEvent(EventRecord *myEvent)
  164. {
  165. short            code;                            /* Location of event in window or controls */
  166. WindowPtr        whichWindow;                    /* Window pointer where event happened */
  167. Point            myPt;                            /* Point where event happened */
  168. ControlHandle    theControl;                        /* Handle for a control */
  169. My_basic_windowPRec        theWS;
  170.  
  171.  
  172. inherited::HandleEvent(myEvent);
  173. code = FindWindow(myEvent->where,&whichWindow);    /* Get where in window and which window */
  174.  
  175. if (this->RecPtr != nil)                        /* Only do if the window is us */
  176.     {
  177.     theWS = this->RecPtr;
  178.  
  179.     if (myEvent->what == mouseDown)
  180.         {
  181.         myPt = myEvent->where;                    /* Get mouse position */
  182.         GlobalToLocal(&myPt);                    /* Make it relative */
  183.  
  184.         if (PtInRect(myPt,&theWS->TERect_Edit_Text))    /* Check for pressed in the TE  Edit Text  */
  185.             {
  186.             }
  187.  
  188.         }
  189.  
  190.     if ((theWS->theWindow == whichWindow) && (code == inContent))    /* for our window */
  191.         {
  192.         myPt = myEvent->where;                    /* Get mouse position */
  193.         GlobalToLocal(&myPt);                    /* Make it relative */
  194.  
  195.         code = FindControl(myPt,whichWindow,&theControl);    /* Get type of control */
  196.         }
  197.     }
  198. }
  199.  
  200.  
  201. /* ======================================================= */
  202. /* ======================================================= */
  203.